/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.storage.entity;

import javax.validation.constraints.NotBlank;

import com.jeesite.common.mybatis.annotation.JoinTable;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 商品规格Entity
 */
@Table(name="biz_goods_spec", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="sort", attrName="sort", label="顺序"),
		@Column(name="brand_id", attrName="brandId", label="品牌id"),
		@Column(name="cate_id", attrName="cateId", label="分类id"),
		@Column(name="goods_id", attrName="goodsId", label="商品id"),
		@Column(name="code", attrName="code", label="条形码"),
		@Column(name="name", attrName="name", label="尺码", queryType=QueryType.LIKE),
		@Column(name="color", attrName="color", label="颜色"),
		@Column(name="price", attrName="price", label="吊牌价"),
		@Column(name="member_price", attrName="memberPrice", label="普通会员价"),
		@Column(name="vip_price", attrName="vipPrice", label="VIP会员价"),
		@Column(name="agent_price", attrName="agentPrice", label="代购费"),
		@Column(name="remarks", attrName="remarks", label="备注"),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false, isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false)
	},
		joinTable = {
				@JoinTable(type = JoinTable.Type.LEFT_JOIN,entity = Brand.class,alias = "b", on = "b.id = a.brand_id",
						columns = {
								@Column(includeEntity =  Brand.class)
						}),
				@JoinTable(type = JoinTable.Type.LEFT_JOIN,entity = Category.class,alias = "c",on = "c.id = a.cate_id",
						columns = {
								@Column(includeEntity =  Category.class)
						}),
				@JoinTable(type = JoinTable.Type.LEFT_JOIN,entity = Goods.class,alias = "g",on = "g.id = a.goods_id",
						columns = {
								@Column(includeEntity =  Goods.class)
						})
		},
		orderBy="a.create_date ASC"
)
public class GoodsSpec extends DataEntity<GoodsSpec> {
	
	private static final long serialVersionUID = 1L;
	private Integer sort;		// 顺序
	private String brandId;		// 品牌id
	private String cateId;		// 分类id
	private String goodsId;		// 商品id
	private String code;		// 条形码
	private String name;		// 尺码
	private String color;		// 颜色
	private Double price;		// 吊牌价
	private Double memberPrice;		// 普通会员价
	private Double vipPrice;		// VIP会员价
	private Double agentPrice;		// 代购费
	private String remarks;		// 备注
	private Goods goods; //商品

	public GoodsSpec() {
		this(null);
	}

	public GoodsSpec(String id){
		super(id);
	}

	@NotNull(message="顺序不能为空")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	@NotBlank(message="品牌不能为空")
	public String getBrandId() {
		return brandId;
	}

	public void setBrandId(String brandId) {
		this.brandId = brandId;
	}

	public String getCateId() {
		return cateId;
	}

	public void setCateId(String cateId) {
		this.cateId = cateId;
	}

	public String getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(String goodsId) {
		this.goodsId = goodsId;
	}

	@NotBlank(message="条形码不能为空")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@NotBlank(message="尺码不能为空")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Double getMemberPrice() {
		return memberPrice;
	}

	public void setMemberPrice(Double memberPrice) {
		this.memberPrice = memberPrice;
	}

	public Double getVipPrice() {
		return vipPrice;
	}

	public void setVipPrice(Double vipPrice) {
		this.vipPrice = vipPrice;
	}

	public Double getAgentPrice() {
		return agentPrice;
	}

	public void setAgentPrice(Double agentPrice) {
		this.agentPrice = agentPrice;
	}

	@Override
	public String getRemarks() {
		return remarks;
	}

	@Override
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

}